using FlowCanvas.Nodes;
using Yoozoo.Gameplay.Liberty.AI;
using Yoozoo.HRP.Runtime;

namespace Yoozoo.Gameplay.Liberty.Nodes
{
    public class SwitchPlayerCamera : CallableActionNode<bool>
    {
        public override void Invoke(bool enable)
        {
            var hCamera = BlueprintUtils.GetPlayerCamera().transform.GetComponent<HCamera>();
            if (hCamera)
            {
                hCamera.enabled = !enable;
                if (enable) {
                    HCameraManager.EnableCamera(hCamera);
                }
                else {
                    HCameraManager.DisableCamera(hCamera);
                }
            }
        }
    }
}